/**
 * 应用入口 App
 **/ 
const App                   = {};

App.RootDirectory           = files.cwd();
App.Common                  = require(App.RootDirectory+"/App/Library/Common.js");
App.Common.RootDirectory    = App.RootDirectory;
App.Config                  = App.Common.AutoRequest("Config","AppConfig");

let AppStart                = App.Common.AutoRequest("Controller","Start");

const InitThreads = threads.start(function(){
    auto();
    setScreenMetrics(App.Config.ScreenX, App.Config.ScreenY); //设置分辨率
    if(!requestScreenCapture()){
        toastLog(App.Config.ScreenCaptureFaildMessage);
        threads.shutDownAll();
    }
    
});

//等待线程
InitThreads.join();

//监听线程
// const MonitorThreads = threads.start(function(){
//     Controller.Start.Monitor();
// });

//运行线程
const AppThreads = threads.start(function(){
    AppStart.Run(App);
});

//等待线程
AppThreads.join();

//中断线程
//MonitorThreads.interrupt();

//结束所有线程
threads.shutDownAll();

module.exports = App;